package com.anosine.gpsl.android;


import java.util.ArrayList;
import java.util.List;

import com.anosine.gpsl.android.entity.Active;
import com.anosine.gpsl.android.util.NetStateManager;

import android.app.Application;
import android.content.Intent;
import android.os.Build;

/**
 * @Title: GPSLApp
 * @Package com.anosine.gpsl.android
 * @Description: 重写Application
 * @author: sunny
 * @date: 2015-11-17
 * @version V1.0
 */
public class GPSLApp extends Application {
	private static GPSLApp sInstance;
	public static String userId, channelId;
	public static String Message;
    public static  Boolean  IsNotify=false;
    public static String Oid;
    public static boolean IsUp=false;
    public static List<Active> mActive = new ArrayList<Active>();

    public static String getOid() {
		return Oid;
	}
    public static void setOid(String oid) {
    	Oid = oid;
	}
	/**
	 * @Title: getMessage()
	 * @Description: 获取透传消息
	 * @param: 无
	 * @return: Message 透传消息
	 * @throws
	 */
	public static String getMessage() {
		return Message;
	}

	/**
	 * @Title: setMessage(String message)
	 * @Description: 赋值透传消息
	 * @param: message
	 * @return: 无
	 * @throws
	 */
	public static void setMessage(String message) {
		Message = message;
	}

	/**
	 * @Title: getuserId()
	 * @Description: 获取百度地图的userId
	 * @param: 无
	 * @return: userId
	 * @throws
	 */

	public static String getuserId() {
		return userId;
	}

	/**
	 * @Title: setuserId(String userid)
	 * @Description: 给userId赋值
	 * @param: userid 百度地图的userId
	 * @return: 无
	 * @throws
	 */

	public static void setuserId(String userid) {
		userId = userid;

	}

	/**
	 * @Title: getchannelId()
	 * @Description: 获取百度地图的channelId
	 * @param: 无
	 * @return: channelId
	 * @throws
	 */

	public static String getchannelId() {
		return channelId;
	}

	/**
	 * @Title: setchannelId(String channelid)
	 * @Description: 给channelId赋值
	 * @param: channelid 百度地图的channelid
	 * @return: 无
	 * @throws
	 */

	public static void setchannelId(String channelid) {
		channelId = channelid;

	}

	/**
	 * 方法名：getApplication() 功 能：获取GPSLApp的上下文 参 数：无
	 * 
	 * @return GPSLApp sInstance
	 * */
	public static GPSLApp getApplication() {
		return sInstance;
	}

	/**
	 * 方法名：getApp() 功 能：获取GPSLApp的上下文 参 数：无
	 * 
	 * @return GPSLApp sInstance
	 * */
	protected GPSLApp getApp() {
		return sInstance;
	}

	/**
	 * 方法名：getInstance() 功 能：获取GPSLApp的上下文 参 数：无
	 * 
	 * @return GPSLApp sInstance
	 * */
	public static GPSLApp getInstance() {
		return sInstance;
	}

	/**
	 * 方法名：onCreate() 功 能：消息响应函数 参 数：无
	 * 
	 * @return 无
	 * */
	@Override
	public void onCreate() {
		super.onCreate();
		sInstance = this;

		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
//			Intent intent = new Intent(this, AppWidgetService.class);
//			startService(intent);
		}
		// afterCreate();
	}

	// protected abstract void afterCreate();
	/**
	 * 方法名：exit() 功 能：退出响应函数 参 数：无
	 * 
	 * @return 无
	 * */
	public void exit() {
		// beforeExit();
		android.os.Process.killProcess(android.os.Process.myPid());
		System.exit(0);
	}
	/**
	 * 方法名：beforeExit() 功 能：需要继承实现的方法，没有实体类，退出之前进行的操作 参 数：无
	 * 
	 * @return 无
	 * */
	// protected abstract void beforeExit();
}
